package karaoke.servlet;

import java.io.IOException;
import java.util.ArrayList;

import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import karaoke.modelo.Local;
import karaoke.modelo.Reserva;
import karaoke.negocio.GestionLocal;
import karaoke.negocio.GestionReserva;

/**
 * Servlet implementation class ReservaListarServlet
 */
@WebServlet("/ReservaListarServlet")
public class ReservaListarServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;
       
    /**
     * @see HttpServlet#HttpServlet()
     */
    public ReservaListarServlet() {
        super();
        // TODO Auto-generated constructor stub
    }

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		try{
			GestionReserva negocio = new GestionReserva();
			
			ArrayList<Reserva> arregloReservas = negocio.selectListaReserva();
			request.setAttribute("reserva", arregloReservas );
			
			RequestDispatcher rd = request.getRequestDispatcher("ReservaBuscar.jsp");
			rd.forward(request, response);
			
			
		}catch(Exception e){
			System.out.println(e);
		}
	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
	}

}
